package com.cloud.logger.zchain.zchainserver.controller;

import com.cloud.logger.zchain.core.common.base.ResultMessage;
import com.cloud.logger.zchain.core.exception.BusinessException;
import com.cloud.logger.zchain.zchainserver.entity.po.ZchainUserPo;
import com.cloud.logger.zchain.zchainserver.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

/**
 * 浙江卓锐科技股份有限公司
 *
 * @author zhengyt
 * @create 2017/12/19
 * @description
 */
@RestController
@RequestMapping(value = "/login")
@Api(value = "/用户登录接口", description = "用户登录接口 -by zhengyt")
public class LoginCtl {

    @Resource
    private LoginService loginService;

    /**
     * @ClassName: LoginCtl
     * @author: wcy
     * @param:  * @param null
     * @return: 
     * @Decription: 
     * @CreateDate: 2017/12/29 
     */
    @PostMapping(value = "/userLogin")
    @ApiOperation(value = "登录 -by zhengyt")
    public ResultMessage login(@RequestBody ZchainUserPo user, HttpServletResponse response) throws BusinessException {
        return loginService.userLogin(user.getUserName(),user.getPassword(),response);
    }


}